//
// Created by Administrator on 2022/1/30.
//

#ifndef CPP_LEARNING_LEETCODE349_H
#define CPP_LEARNING_LEETCODE349_H

#include <vector>
using namespace std;
#include <math.h>
#include <iostream>

#include <unordered_set>
class Solution349 {
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
        vector<int> result;
        unordered_set<int> set1(nums1.begin(), nums1.end());
        unordered_set<int> set2(nums2.begin(), nums2.end());
        for(auto& i : set2){
            if(set1.find(i) != set1.end()){
                result.push_back(i);
            }
        }
        return result;
    }
};
#endif //CPP_LEARNING_LEETCODE349_H
